package com.niuniu.rushdorm.mapper;
/**
 * @author rambo
 * 2022/11/25
 */
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.niuniu.rushdorm.pojo.entity.Building;
import com.niuniu.rushdorm.pojo.response.BuildingInfo;
import com.niuniu.rushdorm.pojo.response.BuildingSketch;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface BuildingMapper {
    @Select("select id building_id,name building_name from buildings where is_del = 0")
    @Results(id = "buildings",value = {
            @Result(property = "building_id",column = "building_id"),
            @Result(property = "building_name",column = "building_name"),
    })
    List<BuildingSketch> GetBuildings();


    @Select("select `describe`,name,image_url from buildings where is_del = 0 and id = #{id}")
    @Results(id = "getBuildingById",value = {
            @Result(property = "image_url",column = "image_url"),
    })
    BuildingInfo GetBuildingById(long id);
}
